package com.example.buttonclicks;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends Activity {

	TextView clickCount;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

	public void onButtonClick(View v)
	{
		clickCount = (TextView)findViewById(R.id.textView2);
		String currentCount = clickCount.getText().toString();
		int currCnt = Integer.parseInt(currentCount);
		currCnt++;
		String nextCount = Integer.toString(currCnt);
		clickCount.setText(nextCount);
	}
	
	public void clearCount(View v)
	{
		clickCount = (TextView)findViewById(R.id.textView2);
		clickCount.setText(Integer.toString(0));
	}
	
	public void quitApp(View v)
	{
		finish();
	}
	
}
